package com.lemon.exam.common.enums;

import com.lemon.exam.common.handler.RouterFunctionHandler;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpMethod;
import org.springframework.web.reactive.function.server.HandlerFunction;
import org.springframework.web.reactive.function.server.ServerResponse;

import java.util.function.Function;

/**
 * 系统路由枚举对象
 *
 * @author Lemon
 * @since 2025/9/12 10:12
 */
@Getter
@AllArgsConstructor
public enum RouteEnum {
    GET_CAPTCHA(HttpMethod.GET, "/getCaptcha", "获取验证码图片", RouterFunctionHandler::getCaptcha),
    REGISTER(HttpMethod.PUT, "/register", "注册", RouterFunctionHandler::register),
    GET_CURRENT_USER(HttpMethod.GET, "/getCurrentUser", "获取当前用户信息", RouterFunctionHandler::getCurrentUser),
    GET_CURRENT_USER_AVATAR(HttpMethod.GET, "/getCurrentUserAvatar", "获取当前用户头像", RouterFunctionHandler::getCurrentUserAvatar),
    GET_ROUTERS(HttpMethod.GET, "/getRouters", "获取路由信息", RouterFunctionHandler::getRouters),
    GET_ROUTER_RESOURCE(HttpMethod.GET, "/getRouterResource", "获取路由和资源信息", RouterFunctionHandler::getRouterResource),
    UPDATE_PASSWORD_BY_EMAIL_OR_PHONE(HttpMethod.PUT, "/updatePasswordByEmailOrPhone", "更新密码", RouterFunctionHandler::updatePasswordByEmailOrPhone),
    SEND_CODE_BY_EMAIL_OR_PHONE(HttpMethod.POST, "/sendCodeByEmailOrPhone", "发送验证码", RouterFunctionHandler::sendCodeByEmailOrPhone),
    UPDATE_CURRENT_USER(HttpMethod.PUT, "/updateCurrentUser", "更新当前用户信息", RouterFunctionHandler::updateCurrentUser),
    UPDATE_CURRENT_USER_PASSWORD(HttpMethod.PUT, "/updateCurrentUserPassword", "更新当前用户密码", RouterFunctionHandler::updateCurrentUserPassword),
    UPLOAD_CURRENT_USER_AVATAR(HttpMethod.POST, "/uploadCurrentUserAvatar", "上传当前用户头像", RouterFunctionHandler::uploadCurrentUserAvatar),
    GET_NOTICE_COUNT_CONNECTION(HttpMethod.GET, "/getNoticeCountConnection", "获取通知连接数", RouterFunctionHandler::getNoticeCountConnection),
    GET_TREE_CLASS_USER_BY_CURRENT(HttpMethod.GET, "/getTreeClassUserByCurrent", "根据当前用户获取班级内的用户树形结构", RouterFunctionHandler::getTreeClassUserByCurrent),
    SEND_NOTICE(HttpMethod.POST, "/sendNotice", "发通知", RouterFunctionHandler::sendNotice),
    GET_NO_SUBMIT_NOTICE(HttpMethod.GET, "/getNoSubmitNotice", "获取未提交的通知", RouterFunctionHandler::getNoSubmitNotice),
    GET_ASIDE_MENU(HttpMethod.GET, "/getAsideMenu", "获取侧边栏菜单", RouterFunctionHandler::getAsideMenu),
    GET_NOTICE(HttpMethod.GET, "/getNotice", "获取通知列表", RouterFunctionHandler::getNotice),
    GET_NOTICE_BY_ID(HttpMethod.GET, "/getNoticeById", "获取通知详情", RouterFunctionHandler::getNoticeById);

    private final HttpMethod method;//请求方式
    private final String path;//请求路径
    private final String description;//描述
    private final Function<RouterFunctionHandler, HandlerFunction<ServerResponse>> handlerFunction;//处理函数
}
